package ar.edu.unlp.info.cptn.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import ar.edu.unlp.info.cptn.model.Asignatura;



public class CursadaValidator implements Validator {

	@Override
	public boolean supports(Class<?> clazz) {
		return Asignatura.class.equals(clazz);
	}

	@Override
	public void validate(Object arg0, Errors errors) {
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "nombre", "error.field.required", "Required field");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "descripcion", "error.field.required", "Required field");
	}

}
